package com.zy.datareceiver.binsess.monitoring.dao.impl;

import com.zy.datareceiver.binsess.monitoring.dao.MonitoringPointDao;
import com.zy.datareceiver.binsess.monitoring.entity.MonitoringPoint;
import com.zy.datareceiver.binsess.monitoring.mapper.MonitoringPointMapper;
import com.zy.datareceiver.binsess.monitoring.param.index.CountTail;
import com.zy.datareceiver.binsess.monitoring.param.query.PointType;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
@CacheConfig(cacheNames = "monitoringPoint")
public class MonitoringPointDaoImpl implements MonitoringPointDao {
    @Resource
    private MonitoringPointMapper monitoringPointMapper;

    @Cacheable(cacheNames = "monitoringPoint")
    @Override
    public MonitoringPoint selectByPrimaryKey(Integer pointId) {
        return monitoringPointMapper.selectByPrimaryKey(pointId);
    }

    @Cacheable(cacheNames = "list")
    @Override
    public List<MonitoringPoint> getMonitoringPointById(Integer id) {
        return monitoringPointMapper.getMonitoringPointById(id);
    }

    @Cacheable(cacheNames = "countTail")
    @Override
    public CountTail countByStatus() {
        return monitoringPointMapper.countByStatus();
    }

    @Cacheable(cacheNames = "PointTypeList")
    @Override
    public List<PointType> getAllPointAndDevice() {
        return monitoringPointMapper.getAllPointAndDevice();
    }
}
